/**
 * Created by 白雨浓 on 2019/1/16 12:09.
 */
import convert2Ast from "./convert2Ast";

const toTable = (ast) => {
  let temp = '';

  ast.items.forEach(item => {
    if (['List', 'Map', 'Set'].indexOf(item.type) >= 0) {
      return;
    }

    temp += `<el-table-column prop="${item.field}" label="${item.annotation}" align="center"></el-table-column>\n`;
  });

  return temp;
};


export default (entity) => {
  return toTable(convert2Ast(entity));
}
